<?php class Controller extends BaseController{
    
    public function init() {
        parent::init();
        $this->view->pageTitle = "XenonPHP - Login";
    }
    
    public function indexAction() {
        
    }
    
    public function loginAction() {
        if ($this->login($_POST['username'], $_POST['password'])) {
            if (!empty($_SESSION['LAST_REQUEST_URI'])) {
                $this->redirect($_SESSION['LAST_REQUEST_URI']);
            } else {
                $this->redirect("index");
            }
        } else {
            $this->forward('index');
        }
    }
    
    public function logoutAction() {
        $this->logout();
        $this->redirect("login");
    }
    
}